package com.wcs.exam.controller.auth.resp;

import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * <p>
 * Auth-用户考勤-响应对象
 * </p>
 *
 * @author wcs
 * @since 2024-07-17
 */
@Getter
@Setter
@Accessors(chain = true)
@Schema(description = "Auth-用户考勤-响应对象")
public class AuthUserAttendanceCheckResp implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @Schema(description = "校验通过(false:不通过、true:通过)")
    private Boolean checkPass;

    @Schema(description = "考勤类型(1:模拟考试、2:正式考试)")
    private Integer attendanceType;

    @Schema(description = "关联ID")
    private Long relateId;

    @Schema(description = "考勤方式(1:点击打卡、2:人脸识别)")
    private Integer attendanceWay;

    @Schema(description = "人脸配置")
    private FaceConfig faceConfig;

    @Schema(description = "点击打卡")
    private ClickConfig clickInConfig;

    @Accessors(chain = true)
    @Data
    public static class FaceConfig implements Serializable {

        @Serial
        private static final long serialVersionUID = 3181013650378449012L;

        @Schema(description = "当前用户是否填写身份证号和真实姓名(false:已填写; true:未填写)")
        private Boolean certification = false;

        @Schema(description = "系统配置-开启人脸核身错误次数限制((false:关闭、true:开启))")
        private Boolean enabledFaceError;

        @Schema(description = "系统配置-人脸核身错误次数限制")
        private Integer faceErrorCount;

        @Schema(description = "系统配置-用户当日错误次数（统计当前用户所有）")
        private Integer faceUserTodayErrorCount;

        /*------------------------------------ 考试相关 ------------------------------------*/

        @Schema(description = "考试开考前-人脸识别(false：关闭、true：开启)")
        private Boolean faceId;

        @Schema(description = "考试开考前-人脸识别限制时间(单位：分钟)【正式考试】")
        private Integer faceIdLimitTime;

        @Schema(description = "考试开考前-人脸识别允许错误次数(单位：次)【正式考试】")
        private Integer faceIdLimitCount;

        @Schema(description = " 考试开考前-人脸识别失败允许考试(false：禁止、true：允许)【正式考试】")
        private Boolean faceIdFailureEnter;

        @Schema(description = "考试开考前-人脸识别失败允许申诉(false：禁止、true：允许)【正式考试】")
        private Boolean faceIdFailureAppeal;

        @Schema(description = "考试开考前-人脸识别是否通过(false：不通过、true：通过)")
        private Boolean faceIdCheckPass;

        @Schema(description = "考试开考前-人脸识别用户错误次数")
        private Integer faceIdUserErrorCount;


        @Schema(description = "考试答题中-人脸抓拍(false：关闭、true：开启)【考试】")
        private Boolean faceCapture;

        @Schema(description = "考试答题中-人脸抓拍时间(单位：分钟)【考试】")
        private Integer faceCaptureTime;

        @Schema(description = "考试答题中-人脸抓拍检测(与开考前人脸识别结果进行对比)【考试】")
        private Boolean faceCaptureDetection;

        @Schema(description = "考试答题中-人脸抓拍高灵敏度检测(在考试过程中，以固定频率（例如3秒/次）监测学员摄像头中是否存在人脸或多张人脸)【考试】")
        private Boolean faceCaptureHighDetection;

        @Schema(description = "考试答题中-人脸抓拍检测错误限制次数【考试】")
        private Integer faceCaptureFailureCount;

        @Schema(description = "考试答题中-人脸抓拍用户错误次数")
        private Integer faceCaptureUserFailureCount;


        // 人脸异常审核返回字段:
        @Schema(description = " 异常审核-申请状态(1:待审核、2:已通过、3:已驳回)【正式考试】")
        private Integer appealStatus;

        @Schema(description = " 异常审核-申请原因【正式考试】")
        private String appealCause;

        @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
        @Schema(description = " 异常审核-审核时间【正式考试】")
        private LocalDateTime auditTime;

        @Schema(description = " 异常审核-通过/驳回说明【正式考试】")
        private String auditOpinion;


        /*------------------------------------ 其他类型相关 ------------------------------------*/

        @Schema(description = "总次数")
        private Integer totalCont;

        @Schema(description = "剩余次数")
        private Integer surplusCount;

        @Schema(description = "失败次数")
        private Integer failCount;
    }

    @Accessors(chain = true)
    @Data
    public static class ClickConfig implements Serializable {

        @Serial
        private static final long serialVersionUID = 4764232429978100375L;

        @Schema(description = "总次数")
        private Integer totalCont;

        @Schema(description = "剩余次数")
        private Integer surplusCount;

        @Schema(description = "失败次数")
        private Integer failCount;
    }
}
